package com.hxs.learn.entity.sys;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldStrategy;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hxs.learn.common.entity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;

import java.util.Date;


/**
 * @author huxinsheng
 * @date 2018-04-24 15:32:13
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "sys_log")
@Alias(value = "SysLog")
public class SysLog implements BaseEntity {
    /**
     * 登入登出
     */
    public final static String LOGTYPE_LOGIN = "1";
    /**
     * 业务请求
     */
    public final static String LOGTYPE_REQUEST = "2";
    /**
     * 异常
     */
    public final static String LOGTYPE_EXCEPTION = "3";

    /**
     * 编号
     */
    @TableField(value = "id")
    private Integer id;
    /**
     * 请求用时
     */
    @TableField(value = "loseTime")
    private Long loseTime;
    /**
     * 创建人
     */
    @TableField(value = "createBy", strategy = FieldStrategy.NOT_EMPTY)
    private String createBy;
    /**
     * 异常信息
     */
    @TableField(value = "exception", strategy = FieldStrategy.NOT_EMPTY)
    private String exception;
    /**
     * 日志类型
     */
    @TableField(value = "logType", strategy = FieldStrategy.NOT_EMPTY)
    private String logType;
    /**
     * 操作方式 GET/POST/DELETE/PUT
     */
    @TableField(value = "method", strategy = FieldStrategy.NOT_EMPTY)
    private String method;
    /**
     * 请求参数
     */
    @TableField(value = "params", strategy = FieldStrategy.NOT_EMPTY)
    private String params;
    /**
     * 操作IP地址
     */
    @TableField(value = "remoteAddr", strategy = FieldStrategy.NOT_EMPTY)
    private String remoteAddr;
    /**
     * 请求URI
     */
    @TableField(value = "requestUri", strategy = FieldStrategy.NOT_EMPTY)
    private String requestUri;
    /**
     * 日志标题
     */
    @TableField(value = "title", strategy = FieldStrategy.NOT_EMPTY)
    private String title;
    /**
     * 用户代理
     */
    @TableField(value = "userAgent", strategy = FieldStrategy.NOT_EMPTY)
    private String userAgent;
    /**
     * 创建时间
     */
    @TableField(value = "createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
}
